#include "sys.h"
#include "led.h"
#include "beep.h"
#include "timer.h"
#include "usart3.h"
#include "exti.h"
#include "keyboard.h"
#include "touch.h"


u8 flag1s;

int main(void)
{		
	int i=0;
	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
	
	delay_init();
	BEEP_Init();
	debug_init(72, 115200);
	usart3_init(115200);
	LED_Init();
	KEY_Init();
	EXTIX_Init();
	TIM3_Int_Init(10-1,7200-1);
	tp_dev.init();
	
	while(1)
	{
		debug_scan();
		KeyDriver();
		UART3_Driver();
		GT9147_Scan(0);
		
		if(flag1s)
		{
			flag1s=0;
			LED1 = !LED1;
			
			i++;
			debug_msg("%d",i);
		}
	}
}

void KeyAction(unsigned char key)
{
	debug_msg("key=%d %d\r\n",key,KEY0);
}

void Uart3Action(unsigned char key,unsigned char num1,unsigned char num2)
{
	
}

void Debug_Action(unsigned char key,unsigned char num1,unsigned char num2)
{
	LED2 = key;
	debug_msg("key=%d %d\r\n",(u16)LED2,key);
}


